package com.quanyue.music.file.mapper;

import com.quanyue.music.domain.entity.UserSurvey;
import com.quanyue.music.file.type.SurveyDetail;
import com.shzisg.mybatis.mapper.auto.AutoMapper;
import com.shzisg.mybatis.mapper.page.Page;
import com.shzisg.mybatis.mapper.page.PageRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SurveyMapper extends AutoMapper<UserSurvey> {
    @Select("select s.id, u.nick_name, u.head_image, s.nominate_index, s.suggest, s.create_time "
            + "from qy_user_survey s "
            + "left join qy_user u on s.user_id = u.id ")
    Page<SurveyDetail> findSurveyDetail(@Param("request") PageRequest request);

    @Select("select s.id, u.nick_name, u.head_image, s.nominate_index, s.suggest, s.create_time "
            + "from qy_user_survey s "
            + "left join qy_user u on s.user_id = u.id "
            + "order by s.create_time desc")
    List<SurveyDetail> findAllDetail();
}
